Skip to content

fix(service-analytics)!: query_dataset refuses a selection that names no measure, as the REST dataset door does - #33141

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-mbqhe2
Nov 13, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-mbqhe2

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #33028

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no skill under skills/** teaches query_dataset selections; the only page naming the tool is the generated content/docs/references/ai/dataset-tools.mdx, whose input shape is unchanged

维护者速读

  • 改了什么:AI 调用 query_dataset(MCP 工具和产品内 AI 对话工具都走同一个执行器)时,如果 selection.measures 是空数组,现在在读任何数据之前直接拒绝,返回 400 VALIDATION_FAILED,错误文案与 REST 接口 POST /api/v1/analytics/dataset/query 对同一请求的回答一字不差。
  • 为什么改:原来空的度量列表会一路传到 SQL 驱动,拼出一个没有选择列的 SELECT,返回 500 DATABASE_ERROR 和驱动原文;带维度时则返回没有任何度量的分组行。REST 那边早就拒绝了,两扇门对同一个请求给出不同答案。
  • 风险与回滚:收紧(BREAKING 标注),但只影响本来就会失败或拿到空分组的调用;带至少一个度量的查询完全不变(有对照用例)。回滚 = revert 本 PR,回到 500 的旧行为,不涉及数据。
  • 先看:packages/services/service-analytics/src/dataset-tools.ts 的 queryDataset 新增的一行判断与上方的文案常量;packages/qa/dogfood/test/dataset-package-scoped-readers.dogfood.test.ts 新增的 REST 与 MCP 同答案用例。
  • 两分钟验证:pnpm --filter @objectstack/service-analytics exec vitest run src/__tests__/dataset-tools.test.ts,预期 28/28 通过,其中两条 refuses measures: [] 用例为绿。
  • 需要你做的:无,席位落地。

BREAKING for a caller that sent query_dataset a selection with measures: [].

  • FROM: the call reached the dataset query with nothing to project. The SQL driver answered 500 DATABASE_ERROR with its own statement error (near "FROM": syntax error), and with dimensions the tool served group rows carrying no measure.
  • TO: the call is refused 400 VALIDATION_FAILED, body.selection.measures must be a non-empty array of measure names., before the dataset is resolved or any row is read: the answer POST /api/v1/analytics/dataset/query gives the same selection. The fix for a caller: name at least one measure from the dataset, as list_datasets lists them.

What changes

  • @objectstack/service-analytics — createDatasetTools(...).queryDataset refuses a selection whose measures is empty, right after the input parse and before the dataset read, with code VALIDATION_FAILED, status 400 and the REST door's sentence. The check runs before resolution, as the REST door's does (answerDatasetQuery judges the measure list before it resolves the dataset), so a missing dataset with no measure gets the same 400 on both doors rather than a 404 on one of them.
  • One guard, both faces. This executor serves the MCP query_dataset tool (packages/runtime/src/domains/mcp.ts, buildMcpBridge) and the product AI's chat tool (execute, the registry face). The chat face had the same gap at the same seam; it is fixed here as an adjacent same-class fix, per claim amendment 6858058804. Evidence: the new unit pin drives both the direct member and execute, and both answered rows at origin/main (below).
  • The MCP door needs no change. errorResultWithCode relays a thrown refusal's code, status and message whole (thrownRefusalEnvelope), so the MCP tool answers exactly what the executor throws. The dogfood pin proves it over the live /api/v1/mcp transport.
  • No packages/spec change. DatasetSelectionSchema still accepts measures: []; the rule is enforced at the two doors, not moved into the shared schema.
  • Why the sentence is written twice, and what holds the two equal. @objectstack/rest (the REST door) and @objectstack/service-analytics / @objectstack/mcp share no runtime dependency, so neither can import the other's check. The dogfood suite, which boots both doors in one stack, holds them to one answer for one caller: the new case sends the same selection to both and asserts equal code, status and message.

Tests

  • packages/services/service-analytics/src/__tests__/dataset-tools.test.ts (+3): measures: [] without and with dimensions is refused 400 VALIDATION_FAILED with the REST sentence on the direct member AND through execute, service.queryDataset is never called and nothing is read; CONTROL: a selection naming a measure, with dimensions, is served on both faces as before.
  • packages/qa/dogfood/test/dataset-package-scoped-readers.dogfood.test.ts (+2, the agreement pin): on the booted showcase, measures: [] without and with dimensions answers 400 VALIDATION_FAILED with the sentence on POST /analytics/dataset/query, and MCP query_dataset answers an error whose code, status and message equal the REST answer's.

Acceptance notes

  • Other callers of the executor's empty projection, grepped (service.queryDataset(, datasetTools(): the REST single and batch doors go through answerDatasetQuery, which already refuses; the MCP tool and the chat tool go through dataset-tools.ts, fixed here. No other door reaches AnalyticsService.queryDataset with a caller's selection.
  • The REST sentence names body.selection.measures; the tools now answer the same words, by the order's parity rule, though a tool input has no body. Rewording it would mean changing both doors together.
  • Ruling grep on the touched surface (ruling|Ruling-ref|maintainer|⛔): dataset-tools.ts L295 and its test L472/L513 cite the admission-first ruling 6766102988 (only holders the caller may query are candidates; a hidden holder is never named). The new refusal is consistent with it: it is judged on the caller's own input before any dataset is read, and names no dataset or holder. The dogfood file has no hit.

Verification

All readings at head 4beb312f (base 7c36f524, origin/main merged once at 4beb312f; the merge brought only packages/lint changes) unless named.

Measured at origin/main first (the premise holds)
  • Unit, dataset-tools.test.ts with the new pins over the unfixed executor (7c36f524): 2 failed | 26 passed (28). Both measures: [] cases were SERVED instead of refused: the direct member returned an answer object (rows, rowCount: 1, provenance, …), not a VALIDATION_FAILED throw.
  • Dogfood, live showcase over /api/v1/mcp with the guard ablated in dist/ (below): MCP query_dataset with measures: [] answered { code: 'DATABASE_ERROR', … } (server log: [sql-driver] DATABASE_ERROR … near "FROM": syntax error), and with dimensions: ['status'] it answered isError: false with rows: the card's two observations, reproduced.
Package tests and typecheck (service-analytics)
  • pnpm --filter @objectstack/service-analytics test — Test Files 215 passed (215), Tests 5187 passed | 332 skipped (5519)
  • pnpm --filter @objectstack/service-analytics typecheck — exit 0; tsc --listFiles includes src/__tests__/dataset-tools.test.ts (1 hit)
  • dataset-tools.test.ts — Tests 28 passed (28)
  • dataset-package-scoped-readers.dogfood.test.ts — Tests 18 passed (18)
Ablations of the guard (both red, both restored)
  • Unit (source): scripts/ablation-replace.mjs on dataset-tools.ts, anchor if (raw.selection.measures.length === 0) throw x1 -> x0, replacement if (false) throw x0 -> x1, blob 788afd5b -> c09a6df0. dataset-tools.test.ts: 2 failed | 26 passed (28), the two refuses measures: [] cases. Restored: blob == HEAD (788afd5b), git diff HEAD empty. The test imports the source, so no dist/ leg.
  • Dogfood (dist/): same anchor, replacement if (raw.selection.measures.length === -7) throw, blob 788afd5b -> befa3942; pnpm --filter @objectstack/service-analytics build; ablation-dist-preflight.mjs @objectstack/service-analytics 'length === -7' exit 0. dataset-package-scoped-readers.dogfood.test.ts: 2 failed | 16 passed (18), the two new cases (DATABASE_ERROR where VALIDATION_FAILED was expected; isError false with dimensions). Restored: blob == HEAD, git diff HEAD empty; rebuilt; ablation-dist-preflight.mjs … --absent exit 0 (marker absent from all 6 built files, tree clean).
Full dogfood battery (Clause-② narrowing arm)

pnpm --filter @objectstack/dogfood test under the verify lock at 4beb312f: Test Files 460 passed | 3 skipped (463), Tests 3876 passed | 42 skipped (3918), VERDICT command-exit 0.

Derived gates and lint

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 4beb312f: 66 families, each run with stdin closed and its exit code recorded before any pipe. --ran reconciles 66 accounted, 65 run, 1 NOT MEASURED:

  • pnpm check:dual-build-cjs-loads — exit 3, PREREQUISITE NOT MET: its self-test passed (93 cases), the scan needs dist/ of packages outside this diff's closure (studio, client-react, scenarios, embedder-openai, knowledge-*). NOT MEASURED; CI runs it.

All other 65 exit 0, check:nul-bytes, check:engine-double-contract, check:test-source-alias, check:cross-package-test-inputs and check:adr-0087-registration among them. node scripts/check-plugin-teardown-shape.mjs --self-test first exited 3 (its pinned positive control was not in the shallow clone); after git fetch origin 621a4876, exit 0, 48 cases. pnpm lint — exit 0. No export was renamed or removed, so check-platform-checklist.mjs is not owed.


Generated by Claude Code

…no measure, as the REST dataset door does

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvxW3CnsR8FmFCXFQn
…ive one answer to a selection naming no measure

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvxW3CnsR8FmFCXFQn
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvxW3CnsR8FmFCXFQn
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

2 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: VALIDATION_FAILED (literal, 45 pages)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json a83c366702b26d653a975d533dde4dabb30030e1 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a975c8990947158dfc1e743764b7325cb5177707 — the merge of head 4beb312f7d335907a8c875904b53a73b1def6165 into base a83c366702b26d653a975d533dde4dabb30030e1, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a975c8990947158dfc1e743764b7325cb5177707 && git checkout a975c8990947158dfc1e743764b7325cb5177707
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a83c366702b26d653a975d533dde4dabb30030e1 4beb312f7d335907a8c875904b53a73b1def6165 && git checkout -B drift-repro a83c366702b26d653a975d533dde4dabb30030e1 && git merge --no-ff 4beb312f7d335907a8c875904b53a73b1def6165

node scripts/docs-audit/affected-docs.mjs --json a83c366702b26d653a975d533dde4dabb30030e1

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#7 · os-tesla · session_01L9qibzuZJBQY4wUQFJbkfx

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 4beb312f7d335907a8c875904b53a73b1def6165
Local-runs: none
Scope: HITS = the Clause-②: no (narrowing) declaration (PR body + .changeset/33028-query-dataset-empty-measures.md) · IMPLEMENTING FILES = packages/services/service-analytics/src/dataset-tools.ts, packages/services/service-analytics/src/__tests__/dataset-tools.test.ts, packages/qa/dogfood/test/dataset-package-scoped-readers.dogfood.test.ts · read-only outside the diff: packages/rest/src/analytics-routes.ts (answerDatasetQuery), packages/mcp/src/mcp-http-tools.ts (thrownRefusalEnvelope, errorResultWithCode, registerDatasetTools), packages/mcp/src/stdio-data-bridge.ts, packages/runtime/src/domains/mcp.ts, packages/spec/src/data/analytics.zod.ts, packages/spec/src/ai/dataset-tools.zod.ts

① Derived judgments

Accept-set changes, all on dataset-tools.ts:queryDataset:

  • Newly refused, right: selection.measures: [] without dimensions. It was a 500 DATABASE_ERROR, never a served answer; now 400 VALIDATION_FAILED. Nothing a caller could use is lost.
  • Newly refused, right, and the one real removal: selection.measures: [] with dimensions. It was served (isError false, group rows with no measure), so a caller could read distinct dimension values this way. REST refuses the same selection (analytics-routes.ts:answerDatasetQuery, selection.measures.length === 0), so the removal is the parity the card asks for. The changeset names it in FROM/TO.
  • Unchanged: measures omitted, null or non-array is refused by QueryDatasetInputSchema before the guard (measures: z.array(z.string()) is required in AnalyticsQuerySchema, taken by reference). So the guard's raw.selection.measures.length always reads an array and cannot throw a TypeError. A filters-only call or a count-style call with no measure is the same measures: [] or omitted case, refused on both doors. No default-measures path exists: neither door fills measures from the dataset.
  • Nothing is refused that REST accepts, and nothing is accepted that REST refuses, for the empty-measures class. Two differences remain in the sentence only, both older than this diff and not widened by it:
    • measures omitted: REST answers the body.selection.measures… sentence; the tool answers the inputRefusal sentence (Invalid query_dataset input: …). Same code and status.
    • measures: [] beside another malformed selection member: REST judges measures before datasetSelectionRefusal, the tool parses the whole input before the guard, so the tool answers the parse sentence. Same code and status. (nit N1)
  • Placement: after QueryDatasetInputSchema.safeParse, before load(service, context), admission and service.queryDataset. Every face reaches this one function: execute (the registry face), packages/runtime/src/domains/mcp.ts (buildMcpBridge, HTTP MCP) and packages/mcp/src/stdio-data-bridge.ts (stdio MCP, not named in the PR body, covered all the same). wiredService still runs first, so an unwired deployment answers 503 before the 400, as it did for every other input refusal.

② Semver level

  • @objectstack/service-analytics: patch with a BREAKING banner is right under AGENTS.md Post-Task Checklist step 3: Metadata-protocol: none takes patch, and "a non-protocol change, widening or breaking, ships patch and keeps its BREAKING banner and ADR-0087 disposition".
  • Metadata-protocol: none is right: no packages/spec file is in the diff and a tool call's selection is not something a metadata author writes.
  • Clause-②: no (narrowing) is well formed (the closed pair; (narrowing) is BREAKING) and line-initial in both the PR body and the changeset. The ! in the title agrees with it.
  • The changeset carries FROM → TO, the one-line fix, and exactly one ADR-0087 marker (not-required (no-migration-prescription)). The disposition is honest: no key or stored shape moves.
  • Skills-docs: none — REASON is present, as a (narrowing) arm owes. Its reason holds for skills/** and content/docs/** (the only hit is the generated content/docs/references/ai/dataset-tools.mdx). See nit N3 for the agent-facing text it does not count.
  • Only one package is listed, and only one publishes a change: packages/qa/dogfood gets a test only, packages/mcp and packages/rest are untouched.

③ Boundary flags

  • check:dual-build-cjs-loads NOT MEASURED locally (exit 3, prerequisite). Accepted as a declared local gap, not a pass. The diff adds no export, entry or build config, so the risk is low, but the verdict on it is CI's. On this head the check-runs read 15 success, 16 skipped, 18 in_progress, 0 failed (list below). ⛔ This PASS covers the contract; it does not stand in for the running checks. The seat reads them all green before it enqueues.
  • Dogfood on the PR. Dogfood Regression Gate (shard/3) is skipped on this head and the summary job is success, so the new agreement pin has not run in CI on the PR. It runs in the queue. The only reading of it at this head is the dev's (18/18 on the file, battery 460 files green). The seat checks dogfood_battery is pinned to 4beb312f and full before enqueue (review-checklist.md); the report says it is.
  • 维护者速读 asks Tesla for a one-line OK "under the fleet rule" (escalated to the seat, nit N4). I find no such rule. AGENTS.md mentions (narrowing) once (step 3: it is BREAKING). The lane docs require, for a narrowing: a CONTRACT_REVIEW_TIER PASS on the current head over the diff outside prose (contract-review.md), the full dogfood battery pinned to the head (os-dev.md, review-checklist.md), the Skills-docs: line, and all checks green. A human approval is owed only by a Tier H governed path (AGENTS.md Prime Directive 14), and this diff touches none (Governed Surface Queue Guard: success). Either the seat cites the ruling that asks for the maintainer's word (a ruling outside the files I may read is possible), or the line comes out of the PR body. Waiting for Tesla is the safe direction, so this blocks nothing.
  • Dev's out-of-scope note 1 (other doors to an empty projection): confirmed. git grep at the head: service.queryDataset( is called from dataset-tools.ts (guarded here), analytics-routes.ts:answerDatasetQuery (already guarded) and packages/metadata-protocol/src/build-probes.ts, which builds its own probe selection, not a caller's. No in-repo caller sends measures: [] on purpose; .execute has no consumer in this repo (the chat face lives downstream), so a downstream caller that relied on the dimensions-only answer is the residual risk the BREAKING banner covers.
  • Dev's out-of-scope note 2 (body. in a tool's sentence): accepted as a deviation. The tool has no body, so the path in the sentence is wrong for an agent, but selection.measures inside it is still the right address and the sentence is the parity the card asked for. Rewording belongs to a card that moves both doors together (nit N2).
  • open_questions: []: nothing to answer.
  • Author: PR user.login is objectstack-fleet[bot], so no off-relay note is owed.
  • Claim drift: the claim's first surface named packages/mcp/src/mcp-http-tools.ts; amendment 6858058804 moved the guard to the shared executor and dropped packages/rest. The diff stays inside the amended surface, and packages/spec is untouched as the claim requires.

④ Design judgment

dataset-tools.ts (SELECTION_MEASURES_REQUIRED, queryDataset):

  • The guard is correct and minimal, and it sits at the one seam every face shares. It reuses the module's refusal() so the thrown value has the same shape as every other coded refusal here.
  • Code, status and message reach the MCP wire whole. mcp-http-tools.ts:registerDatasetTools catches into errorResultWithCode, which calls thrownRefusalEnvelope: code passes through wireCodeOf (only the engine's duplicate-record code is rewritten), message is sandboxBusinessMessage(err) ?? messageOf(err) (the refusal is not a sandbox error), status is copied when numeric. So VALIDATION_FAILED / 400 / the sentence arrive unchanged, and packages/mcp needs no change, as the dev says.
  • The sentence equals REST's by copy, not by construction. The literal in dataset-tools.ts matches analytics-routes.ts:answerDatasetQuery byte for byte at this head. No shared constant holds them; @objectstack/rest and @objectstack/service-analytics do not depend on each other, and the claim barred a packages/spec home. The dogfood pin is the only thing that reds if one side is reworded, and it runs in the queue, not on the PR. Accepted for this card (nit N2).

dataset-tools.test.ts:

  • The two it.each cases fail without the guard: the unfixed executor returns an answer object, which fails toMatchObject({ code, status }), and spy / reads fail too. They pin both the direct member and execute, the literal sentence, and that nothing is read. The dev's ablation A1 (2 failed) agrees with what the assertions say.
  • The CONTROL case pins that a selection with a measure is still served on both faces. It would catch a guard that refuses too much.
  • Not pinned: a missing dataset with measures: [] answers 400 rather than 404 (the ordering the code comment and PR body claim). The "reads nothing" assertion covers the order indirectly. (nit N5)

dataset-package-scoped-readers.dogfood.test.ts:

  • The comparison is real, not a tautology. REST's status, code and message are each pinned to a literal first; then the MCP answer, read over the live /mcp transport by the file's tool() helper, must equal { code, status, message } taken from the REST response. A drift on either door reds it. Both selection shapes are driven.
  • It would catch the regression: without the guard MCP answers DATABASE_ERROR or isError false, as ablation A2 reports.

Attempts to break it, none of which landed: measures omitted or null (parse refuses first, no TypeError); selection missing (parse); a caller passing a parse output with defaults (the schema has no default for measures); a face that bypasses queryDataset (none: stdio, HTTP and execute all bind createDatasetTools); a status or code rewritten in transit (not for this code); drift from main (the three files I compared differ from origin/main only by this diff's 16 lines).

Findings:

  • N1 (nit): dataset-tools.ts:queryDataset vs analytics-routes.ts:answerDatasetQuery. For an input that is wrong twice (measures: [] plus another bad selection member) the two doors pick a different sentence, because REST judges measures before the selection parse and the tool after. Same code and status; older than this diff. Accepted deviation.
  • N2 (nit): dataset-tools.ts:SELECTION_MEASURES_REQUIRED. Parity by copy, and the copied sentence says body. on a face with no body. A follow-up card could give the sentence one home both doors can import and reword it for both. Not owed here.
  • N3 (nit): the agent-facing text does not state the rule. dataset-tools.ts:QUERY_DATASET_DESCRIPTION and packages/mcp/src/skill-md.ts list measures without "at least one", and the advertised input schema still accepts [] (DatasetSelectionSchema, untouched by the claim's order). An agent learns the rule from the refusal, which is prescriptive enough. The Skills-docs: none reason is true as worded but does not count these two texts. Follow-up at the seat's choice.
  • N4 (nit, prose face, escalated in ③): PR body 维护者速读, last bullet, cites a fleet rule I cannot find.
  • N5 (nit): dataset-tools.test.ts: no case for an unknown datasetName with measures: [] answering 400.

No must-fix, no should-fix. Final round for this head; the nits are accepted deviations or follow-up material.

Check-runs read on this head (49 total): success 15, skipped 16, in_progress 18, failed 0.

  • success: Check Changeset · Check PR Size · PR-body guards · Governed Surface Queue Guard · Spec property liveness · Flag docs affected by code changes · Lint · PM dispatch-gates · Lint · scoped · tooling self-tests · Plan Test Core shards · Dogfood Regression Gate (summary) · Test UI (summary) · Auto Label · filter · Lint · docs & code guards · Type Check · debt ledger.
  • in_progress: Test Core 1/8 to 8/8 · Build Core · Live E2E UI · Type Check (workspace, source gates, consumer gates) · Lint (ESLint, repo & tooling gates, CI/release & engine gates, scoped slot lookup, scoped query-options erasure).
  • skipped: the UI jobs, Dogfood Regression Gate shards, Dogfood Verify CLI, Build Docs, queue verdicts, opt-in harnesses.

Implemented-by: claude/project-thread-mbqhe2
Reviewed-by: session_01L9qibzuZJBQY4wUQFJbkfx

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#7 · os-tesla · session_01L9qibzuZJBQY4wUQFJbkfx

维护者速读 · PR #33141 @ 4beb312f · 2026-11-13T17:54Z

  • 改了什么:智能体通过 MCP(或聊天里的执行入口)调 query_dataset 时,如果 measures 是空数组,现在直接返回 400 VALIDATION_FAILED,提示语与 REST 数据集接口一字不差。以前它会一直打到数据库:不带维度时返回 500,带维度时还会当作成功返回。
  • 为什么改:同一个查询,两个入口给出不同结果,智能体拿不到能照着改的原因(MCP query_dataset with an empty selection.measures reaches the SQL driver and answers 500 DATABASE_ERROR, while the REST twin refuses it 400 #33028)。
  • 权限与边界:只在解析之后、读取之前多了一道检查,不读数据、不改权限。packages/mcp、REST 和规格都没有改。
  • 风险与回滚:这是一处收紧。以前带维度、空度量的调用能拿到行,现在被拒;REST 一直拒绝这种调用,changeset 里写明了 BREAKING。回滚就是 revert。
  • 先看:service-analytics/src/dataset-tools.ts 的 queryDataset 守卫;dogfood dataset-package-scoped-readers 里 REST 与 MCP 对比的两条。
  • 需要你做的:无,席位落地。
  • 席位意见:落地。收紧面做了契约复审(CONTRACT_REVIEW_TIER),PASS,只有 nit;完整 dogfood 跑在本 head 上;CI 全绿;没有碰受管面,改动 98 行。

席位核对

  • 形态: draft → main,正文 Fixes #33028,合并后应当关卡;正文其余地方没有挨着别的 open 卡号的闭合关键词。Clause-②: no (narrowing)、Metadata-protocol: none,Skills-docs: none(理由见正文,复审 N3 认为成立)。标题带 !。changeset 33028-query-dataset-empty-measures.md 是 @objectstack/service-analytics patch,带 BREAKING 说明(非协议的破坏性改动按 AGENTS.md 发 patch)。没有改 content/docs/releases/。文件面 = 认领 6857989541 及其修订。
  • 前提实测: dev 在 origin/main 7c36f524 上复现:单测 2 红,dist 消融下 dogfood 2 红,与卡上一致(报告 6859967166)。
  • 门禁 check-runs @ 4beb312f: 56 个,38 success、18 skipped、0 失败。本地:完整 dogfood 在本 head 上 460 个文件通过、3 跳过,3876 个测试通过,exit 0;66 个门禁里 65 个 exit 0,1 个 NOT MEASURED(dual-build-cjs-loads,前置 dist 不在闭包内,本 diff 不加导出、不改构建配置,以 CI 为准);pnpm lint 0。
  • 契约复审: 6860080278 在 4beb312f 上 PASS(CONTRACT_REVIEW_TIER,narrowing 面,带 ④)。没有必须修和应修,nit N1–N5。
  • 接受的偏差: N1 同时错两处时,两个入口的提示语不同(code 与 status 相同,早于本 diff);N2 提示语靠复制、由 dogfood pin 守住;N3 工具描述没写"至少一个度量";N5 未知数据集加空度量的先后没有单独 pin。N4(速读里引用了一条不存在的"收紧需维护者同意"规则)已由 dev 用 issue_patch 改正,回读一致。
  • 范围外去向: 其他 queryDataset( 调用方只有 REST(已有守卫)和 metadata-protocol 的 build probe(自带度量),无需新卡。
  • 落地条款: 维护者常设落地令 「按 pm-dispatch 审过的pr你可以自主落地」 (2026-10-30T14:20Z)。非受管面(check-governed-merges --pr 33141:0/4 命中);98 行 ≤ 3000。K = 4(PRBASE a83c3667,取自 Test Core 计划的 Affected-set diff base;origin/main 69c77ad6),< 15,无需先 merge main。与已合并的 fix(service-analytics): a lookup dataset dimension serves the referenced record's name for a relationship path and for a target titled by its nameField #33136 同包不同文件。没有新的语种包。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP query_dataset with an empty selection.measures reaches the SQL driver and answers 500 DATABASE_ERROR, while the REST twin refuses it 400

2 participants